package com.mzj.saas.mservice.ad.controller;

import com.mzj.saas.commons.ResultBean;
import com.mzj.saas.mservice.ad.service.AdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 广告接口
 *
 */
@Controller
@RequestMapping("/ad")
public class AdController {

    @Autowired
    private AdService adService;




    /**
     * 根据广告位查询
     * @param space 广告位
     * @return
     */
    @GetMapping(value ="/getAd")
    @ResponseBody
    public ResultBean<Object> getAd(@RequestParam(value = "space") String space){
        return adService.getAd(space);
    }



    /**
     * 根据广告位查询--------App端广告
     * @param code 广告位
     * @return
     */
    @GetMapping(value ="/getAdByCode")
    @ResponseBody
    public ResultBean<Object> getAdByCode(@RequestParam(value = "code") String code){
        return adService.getAdByCode(code);
    }



}
